<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:th="http://www.thymeleaf.org"
      xmlns:sec="http://www.thymeleaf.org/thymeleaf-extras-springsecurity4">
<!--导航栏 fixed-->
<div id="top" class="fixed" data-th-fragment="top">
    <!-- .navbar -->
    <nav class="navbar navbar-static-top">
        <div class="container-fluid m-0">
            <a class="navbar-brand float-left" th:href="@{/}">
                <h4><img th:src="@{/img/logo.png}" class="admin_img" alt="logo"/>&nbsp;Python程序自动评判系统</h4>
            </a>
            <!-- center-->
            <div class="menu hidden-lg-up float-left">
                    <span class="toggle-left" id="menu-toggle">
                        <i class="fa fa-bars"></i>
                    </span>
            </div>
            <!-- #center-->
            <div class="topnav dropdown-menu-right float-right">

                <div sec:authorize="isAnonymous()">
                    <a th:href="@{/user/registerPage}"
                       class="btn btn-info ml-2 button-rounded float-right mt-1 glow_button"
                       style="width: 60px">
                        注册
                    </a>
                    <a th:href="@{/user/loginPage}" class="btn btn-primary button-rounded  float-right mt-1 glow_button"
                       style="width: 60px">
                        登录
                    </a>
                </div>
                <div sec:authorize="isAuthenticated()">
                    <div class="btn-group " >
                        <!--todo-->
                        <div class="btn-group hidden-md-up small_device_search" data-toggle="modal"
                             data-target="#search_modal">
                            <i class="fa fa-search text-primary"></i>
                        </div>
                </div>
                    <div class="btn-group">
                        <div class="user-settings no-bg">
                            <button type="button" class="btn btn-default no-bg micheal_btn" data-toggle="dropdown">
                                <img th:src="${#authentication.principal.avatar} == null ? '/img/default_avatar.jpg' :
                                 ${#authentication.principal.avatar}" class="admin_img2  rounded-circle "
                                     alt="avatar"/>
                                <strong>[[${#authentication.principal.name}]]</strong>
                                <span class="fa fa-sort-down white_bg"></span>
                            </button>
                            <div class="dropdown-menu drop_box_align">
                                <a class="dropdown-item title" href="#">
                                    [[${#authentication.principal.name}]]</a>
                                <a class="dropdown-item"
                                   th:href="@{'/user/mainPage?userId='+${#authentication.principal.id}}">
                                    <i class="fa fa-user"></i>
                                    我的主页</a>
                                <a class="dropdown-item" th:href="@{/user/profilePage}"><i class="fa fa-cog"></i>
                                    信息编辑</a>
                                <a class="dropdown-item" th:href="@{/user/logout}"><i class="fa fa-sign-out"></i>
                                    退出</a>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            <div class="top_search_box float-right hidden-sm-down">
                <form class="header_input_search float-right" th:action="@{/problem/problemListPage}" method="post">
                    <input type="text" placeholder="题目搜索" name="keyword">
                    <button type="submit">
                        <span class="font-icon-search"></span>
                    </button>
                    <div class="overlay"></div>
                </form>
            </div>
        </div>
        <!-- /.container-fluid -->
    </nav>
    <!-- /.navbar -->
    <!-- /.head -->
</div>
</html>